Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.3K
Views
TypeError [INVALID_TYPE]: Supplied data.type is not a valid MessageComponentType - Discord.js

hey im trying to make a slashCommand that generate random pics with button..

so when a user use the command it will sent an embed with button and then the button when a user clicked that, the embed will edited and load another picture

but It seems i was doing it wrong..

Node: v17.7.2

Discord.js: 13.2.0

here is my code

const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const superagent = require('superagent');
const ee = require("../../config.json");

module.exports = {
        name: 'waifu',
        description: 'Give you a random anime waifus pics',
    run: async (client, interaction, args) => {
      let { body } = await superagent.get(`https://api.waifu.pics/sfw/waifu`);
      const msg = await interaction.followUp({
        embeds: [
          new MessageEmbed()
          .setColor(ee.color)
          .setTitle("Waifu 😳")
          .setImage(body.url)
          .setTimestamp()
        ],
        components: [
          new MessageActionRow()
          .addComponents(
            new MessageButton()
            .setCustomId('nextWaifu')
            .setLabel('More Waifu')
            .setStyle('SUCCESS')
          )
        ],
        fetchReply: true
      });
      let embed = msg.embeds
      embed.color = ee.color;
      embed.image = body.url;

      let components = msg.components
      
       return msg.edit({ embeds: [embed], components: [components], fetchReply: true });
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!